use crate::utils::{Message, TaskManager};
use heapless::spsc::Queue;
use lazy_static::lazy_static;
use r2d2::Pool;
use r2d2_sqlite::SqliteConnectionManager;
use std::sync::{Arc, Mutex};

// 定义全局消息队列
lazy_static! {
    pub static ref GLOBAL_QUEUE: Arc<Mutex<Queue<Message, 1024>>> =
        Arc::new(Mutex::new(Queue::new()));
    // 定义全局数据库连接池
    pub static ref GLOBAL_POOL: Pool<SqliteConnectionManager> = {
        let manager = SqliteConnectionManager::file("./resources/database/data.db");
        Pool::new(manager).unwrap()
    };
    pub static ref GLOBAL_TASK_MANAGER: Arc<TaskManager> = Arc::new(TaskManager::new());
}
